package cn.zniot.so.transport.asynpack;

/**
 * 报文类型指示
 */
public enum PacketType {
	// LOGIC_D:逻辑控制返回数据报文
	HB_D,Zniot2,LOGIC_D,Zniot;

	/**
	 * 获取String类型的报文类型指示
	 * 
	 * @param type
	 * @return
	 */
	public static String getType(PacketType type) {
		String str = null;
		switch (type) {
		case HB_D:
			str = "HB_D";
			break;
		case Zniot2:
			str="Zniot2";
			break;
		case LOGIC_D:
			str="LOGIC_D";
			break;
		case Zniot:
			str="Zniot";
			break;
		}
		return str;
	}

	/**
	 * 获取PacketType类型的报文类型指示
	 */
	public static PacketType getType(String type) {
		PacketType packType = null;
		if ("HB_D".equalsIgnoreCase(type)) {
			packType = HB_D;
		}if("Zniot2".equalsIgnoreCase(type)) {
			packType = Zniot2;
		}if("LOGIC_D".equalsIgnoreCase(type)) {
			packType = LOGIC_D;
		}if("Zniot".equalsIgnoreCase(type)) {
			packType = Zniot;
		}
		return packType;
	}

}
